$(document).ready(init);
function init(){
	var nowTemp = new Date();
	var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
	if($('#dpFrom').length){
		var checkin = $('#dpFrom input').datepicker({
			format: 'dd/mm/yyyy',
		  	onRender: function(date) {
				return date.valueOf() < now.valueOf() ? 'disabled' : '';
			}
		}).on('changeDate', function(ev) {
		  	if(ev.date.valueOf() > checkout.date.valueOf()) {
		    	var newDate = new Date(ev.date)
		    	newDate.setDate(newDate.getDate() + 1);
		    	checkout.setValue(newDate);
		  	}
		  	checkin.hide();
		  	$('#dpTo input')[0].focus();
		}).data('datepicker');
	}

	if($('#dpTo').length){
			var checkout = $('#dpTo input').datepicker({
			format: 'dd/mm/yyyy',
		  	onRender: function(date) {
		    	return date.valueOf() <= checkin.date.valueOf() ? 'disabled' : '';
		  	}
		}).on('changeDate', function(ev) {
		  checkout.hide();
		}).data('datepicker');
	}
	//slide show
	if($('#slider').length){
		slide();
	}
	if($('#dpTo').length){
		if(!fromDate){
			var fromDate = new Date();
	    }
	    myMinDate = 0;
		if (typeof fromDate !== 'undefined') {
			checkin.setValue(fromDate.setDate(fromDate.getDate()));
		    fromDate.setDate(fromDate.getDate() + 3);
		    checkout.setValue(fromDate);
	    }
	}
	//room slide
	$('.room-slide').carousel({
	  	interval: 5000
	})
}	
function slide(){
	$('#slider').rhinoslider({
					effect: 'chewyBars',
					easing: 'easeInOutBounce',	
					controlsKeyboard: false,
					controlsPrevNext: false,
					controlsPlayPause: false,
					showControls:false,
					showBullets: 'never',
					autoPlay: true,
					effectTime: 5000,
					showTime: 3000
				});		
		
}